package com.hengpeng.itfinbase.persist;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cascade;

import com.hengpeng.common.web.annotation.HtmlInput;
import com.hengpeng.common.web.annotation.HtmlInputPattern;
import com.hengpeng.common.web.annotation.HtmlInputType;
import com.hengpeng.itfinbase.idAssign.AbstractAssign18IdEntity;

/**
 * <pre>
 * 快捷按钮
 * </pre>
 * @author chenjian
 * @version 1.0, 2011-10-25
 */
@Entity
public class ShortcutMenu extends AbstractAssign18IdEntity
{
	private static final long serialVersionUID = -3846142256784072171L;

	/**
	 * 是否共享
	 */
	@Column(length = 10)
	@Enumerated(javax.persistence.EnumType.STRING)
	private BoolValue isShare;

	/**
	 * 名称
	 */
	@Column(length = 20)
	@HtmlInput(label = "标签名称", type = HtmlInputType.TEXT, maxLength = 20, index = 1, nullable = false)
	private String name;

	/**
	 * 关联的节点集合
	 */
	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER, mappedBy = "menu")
	@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
	private Set<ShortcutMenuNode> nodeSet;

	/**
	 * 备注
	 */
	@HtmlInput(label = "备注", type = HtmlInputType.TEXTAREA, index = 4, nullable = true)
	private String remark;

	@HtmlInput(label = "排序", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.INT, index = 2, nullable = false)
	private Long sortLevel;

	/**
	 * 连接地址
	 */
	@Column(length = 255)
	@HtmlInput(label = "URL地址", type = HtmlInputType.TEXT, maxLength = 255, index = 3)
	private String url;

	/**
	 * 用户登录名
	 */
	@HtmlInput(label = "登录名", type = HtmlInputType.LABEL, index = 5, nullable = false)
	private Long userId;

	public BoolValue getIsShare()
	{
		return isShare;
	}

	public String getName()
	{
		return name;
	}

	public Set<ShortcutMenuNode> getNodeSet()
	{
		return nodeSet;
	}

	public String getRemark()
	{
		return remark;
	}

	public Long getSortLevel()
	{
		return sortLevel;
	}

	public String getUrl()
	{
		return url;
	}

	public Long getUserId()
	{
		return userId;
	}

	public void setIsShare(BoolValue isShare)
	{
		this.isShare = isShare;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public void setNodeSet(Set<ShortcutMenuNode> nodeSet)
	{
		this.nodeSet = nodeSet;
	}

	public void setRemark(String remark)
	{
		this.remark = remark;
	}

	public void setSortLevel(Long sortLevel)
	{
		this.sortLevel = sortLevel;
	}

	public void setUrl(String url)
	{
		this.url = url;
	}

	public void setUserId(Long userId)
	{
		this.userId = userId;
	}

}
